//
//  ViewController.m
//  内存管理
//
//  Created by MyMac on 15/6/5.
//  Copyright (c) 2015年 MyMac. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController
-(void)dealloc
{
    [super dealloc];
    NSLog(@"111");

}
- (void)viewDidLoad {
    [super viewDidLoad];
    NSString *str = [[NSString alloc]initWithString:@"火锅火锅"];
 NSString*a=[str retain];//mrc中指针给指针赋值不会使对象的引用计数加1，，必须retain
    NSString*c=a;
//
//         [str release];
//    str=nil;
    NSLog(@"%i %@  %lu  %@",str.retainCount,str,a.retainCount,c);
    
  
    
  //  a=nil;

   
   
   // NSString*b=nil;
//    @autoreleasepool {
//      b=[NSString stringWithFormat:@"%f",111.0];
//       
//   NSLog(@"%ld",b.retainCount);
//    }
    
  
    
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
